/*
 * Copyright 2011 Angel Sanadinov
 *
 * This file is part of VBox WMI.
 *
 * VBox WMI is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * VBox WMI is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with VBox WMI.  If not, see <http://www.gnu.org/licenses/>.
 */

package Beans.Requests.MachineManagement.Components;

/**
 * This class represents the CPU settings of a virtual machine.
 *
 * @author Angel Sanadinov
 */
public class CPUSettings extends MachineManagementComponent
{
    private boolean isCPUHotPlugEnabled; //CPU hot plugging state
    private int CPUCount;                //number of CPUs on the machine

    /**
     * Constructs a CPU settings object with the specified data.
     *
     * @param CPUHotPlugEnabled the CPU hot plugging state
     * @param CPUCount the number of CPUs allocated to the machine
     */
    public CPUSettings(boolean CPUHotPlugEnabled, int CPUCount)
    {
        this.isCPUHotPlugEnabled = CPUHotPlugEnabled;
        this.CPUCount = CPUCount;
    }

    /**
     * Retrieves the CPU hot plugging state.
     *
     * @return <code>true</code> if CPU hot plugging is enabled or <code>false</code>
     *         otherwise
     */
    public boolean getIsCPUHotPlugEnabled()
    {
        return isCPUHotPlugEnabled;
    }

    /**
     * Retrieves the number of CPUs allocate to the machine
     *
     * @return the number of CPUs
     */
    public int getCPUCount()
    {
        return CPUCount;
    }

    @Override
    public boolean isValid()
    {
        if(CPUCount > 0)
            return true;
        else
            return false;
    }
}
